<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link href="../css/viewapplicant.css" rel="stylesheet" type="text/css" /> 

<?php
include __DIR__ ."../../PHP/db.php";

$refidcontainer = $_GET['refid'];

$getid = mysql_query("SELECT * FROM `flss`.`applicant` WHERE `refid` = '$refidcontainer'");
while($getallrow = mysql_fetch_array($getid))
{
	$appid = $getallrow['applicant_id'];
	$appname = $getallrow['fname'].' '.$getallrow['mname'].'. '.$getallrow['lname'];
	$appgender = $getallrow['gender'];
	$appcivilstatus = $getallrow['civilstatus'];
	$appreligion = $getallrow['religion'];
	$appdob = $getallrow['dob'];
	$apppob = $getallrow['pob'];
	$appchildren = $getallrow['children'];	
	$appweight = $getallrow['weight'];
	$appheight = $getallrow['height'];
	$appnation = $getallrow['nationality'];
	$appmother  = $getallrow['mother'];
	$appfather = $getallrow['father'];
	 $cphoto = $getallrow['photo'];
}

$getpassport = mysql_query("SELECT * FROM `flss`.`passport` WHERE `applicant_id` = '$appid'");
while($getrowpassport = mysql_fetch_array($getpassport))
{
	$numb = $getrowpassport['number'];
	$issue = $getrowpassport['issue_date'];
	$expire = $getrowpassport['expiry_date'];
	$place = $getrowpassport['placeofissue'];
	}

$getaddress = mysql_query("SELECT * FROM a_address WHERE applicant_id = '$appid'");
while($getaddressrow = mysql_fetch_array($getaddress))
{
	$address = $getaddressrow['a_address'];
	$city = $getaddressrow['city'];
	$country = $getaddressrow['country'];
	
	}
	
$geteduc = mysql_query("SELECT * FROM a_educ WHERE applicant_id = '$appid'");
$getexp = mysql_query("SELECT * FROM a_experience WHERE applicant_id = '$appid'");

$lang = mysql_query("SELECT * FROM a_language WHERE applicant_id = '$appid'");
while($rowlang = mysql_fetch_array($lang))
{
	$engS = $rowlang['engSpeaking'];
	$engW = $rowlang['engWriting'];
	$arabS = $rowlang['arabSpeaking'];
	$arabW = $rowlang['arabWriting'];
	}

$gethired = mysql_query("SELECT Count(*) as total FROM hired_applicants WHERE applicant_id = '$appid'") or die(mysql_error());
$photo = empty($cphoto) ? DEFAULT_COVER : IMAGE_URL_SMALL.$cphoto;


?>

<title> RESUME </title>
</head>

<body>

<div class="main">
	<div class="overallcontainer">
		<div class="topcontainer">
        	<div class="headerlogo">
            	<div class="flsslogo">
                	<img src="../images/handlogo.png" height="90" width="100">
                </div>
                <div class="flssname">
                	<p> Famous Labor Supply Service </p>
                </div>
                <div class="flssaddress">
                	<p><span> Flat No. 130, Abdula Saeed Billhab Building, Corner Damascus St. & Hallab Street 
                    Infront Dubai </span>
                    <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    Abatloir P.O. Box : 92726, Dubai - U.A.E. Tel..:+971 426 78875, Fax: +971 426 78876 </span></p>
                </div>
            </div>
        </div>
		<div class="bodycontent">
			<div class="bodydivider">
            	<div class="bodyleft">
                	<div class="photo">
                    	<img src="<?=$photo?>" id="myPic" width="180" height="180" style="margin-top:2px;">
                    </div>
                 </div>
                <div class="bodyright">
                	<div class="details">
                    	&nbsp;&nbsp;&nbsp;<?=$appname?>
                    </div>
                  <div class="blank">
                   	<?php if($_SESSION['level'] == '2') {  	
					?>&nbsp;&nbsp;&nbsp;Address: 
                    <?php } ?>
                  	<?php if($_SESSION['level'] == '3') {  	
					?>
                    	&nbsp;&nbsp;&nbsp;Address: <?=$address.' '.$city.' '.$country?>
                    <?php } ?>
                  	
                    </div>
                   <div class="nationality">
                    	&nbsp;&nbsp;&nbsp;Nationality: <?=$appnation?>
                    </div>
                    <div class="dateofbirth">
                    	&nbsp;&nbsp;&nbsp;Date of Birth: <?=$appdob?>
                    </div>
                    <div class="placeofbirth">
                    	&nbsp;&nbsp;&nbsp;Place of Birth: <?=$apppob?>
                    </div>
               </div>
               <div class="detailscontainer">
               		<div class="detailslong">
                   		<center>
                         Applicant Details 
                   		</center>
                   	</div>
                    <div class="detailsbody">
                    	<table width="100%" border="9" >
                        <tr>
                        <td>
                        	Religion:
                        </td>
                        <td>
                        	<?=$appreligion?>
                        </td>
                        </tr>
                        <tr>
                        <td>
                        	Civil Status:
                        </td>
                        <td>
                        	<?=$appcivilstatus?> 
                        </td>
                        </tr>
                        <tr>
                        <td>
                        	Height:
                        </td>
                        <td>
                        	<?=$appheight?> cm
                        </td>
                        </tr>
                        <tr>
                        <td>
                        	Weight:
                        </td>
                        <td>
                        	<?=$appweight?> kl
                        </td>
                        </tr>
                        <tr>
                        <td>
                        	No of Children:
                        </td>
                        <td>
                        	<?=$appchildren?>
                        </td>
                        </tr>
                        <tr>
                        <td>
                        	Father's Name:
                        </td>
                        <td>
                        	<?=$appfather?>
                        </td>
                        </tr>
                        <tr>
                        <td>
                        	Mother's Name:
                        </td>
                        <td>
                        	<?=$appmother?>
                        </td>
                        </tr>
                        </table>
                    </div>
               </div>
               <div class="passportcontainer">
               		<div class="passportdetails">
                    	<center>
                        Passport Details
                    	</center>
                    </div>
                    <div class="passportbody">
                    	<table width="100%" border="9" >
                        	<tr>
                            <td>
                            	Number:
                            </td>
                            <td>
                            	<?=$numb?>
                            </td>
                            </tr>
                            <tr>
                            <td>
                            	Issue Date:
                            </td>
                            <td>
                            	<?=$issue?>
                            </td>
                            </tr>
                            <tr>
                            <td>
                            	Expiry Date:
                            </td>
                            <td>
                            	<?=$expire?>
                            </td>
                            </tr>
                            <tr>
                            <td>
                            	Place of Issue:
                            </td>
                            <td>
                            	<?=$place?>
                            </td>
                            </tr>
                            
                        </table>
                    </div>
               </div>
               <div class="languageknowncontainer">
               		<div class="languageknowndetails">
                    	<center>
                        Language Known
                    	</center>
                    </div>
                    <div class="lkbody">
                    	<table width="100%" border="9" >
                       		<tr>
                            <td>
                            English Skills
                            </td>
                            <td>
                            1 to 5 scale. 5 is the highest.
                            </td>
                            </tr>
                            <tr>
                            <td>
                             Written Proficiency:
                            </td>
                            <td>
                            <center>
                            <?=$engW?>
                            </center>
                            </td>
                            </tr>
                            <tr>
                            <td>
                            Speaking Proficiency:
                            </td>
                            <td>
                            <center>
                            <?=$engS?>
                            </center>
                            </td>
                            </tr>
                            <tr>
                            <td>
                            	Arabic Skills
                            </td>
                             <td>
                            1 to 5 scale. 5 is the highest.
                            </td>
                           
                            </tr>
                            <tr>
                            <td>
                            	Writing Proficiency:
                            </td>
                            <td>
                            <center>
                            	<?=$arabW?>
                            </center>
                            </td>
                            </tr>
                            <tr>
                            <td>
                            	Speaking Proficiency:
                            </td>
                            <td>
                            <center>
                            	<?=$arabS?>
                            </center>
                            </td>
                            </tr>

                        </table>
                    </div>
               </div>
               
               <div class="educbackcontainer">
               		<div class="educbackdetails">
                    	<center>
                        Educational Attainment
                        
                    	</center>
                    </div>
                    <div class="educbody">
               		<table  width="100%" border="9">
                    <tr>
                    <th> Educational Level </th>
                    <th> School / University </th>
                    <th> Field of Study </th>
                    <th> Major </th>
                    <th> Graduation Date </th>
                    <th> Location </th>
                    </tr>
					<?php
					while($roweduc = mysql_fetch_array($geteduc))
					{
						?>
						<tr>
						<td>
						<?=$roweduc['educ_level'];?>
                        </td>
                        <td>
                        <?=$school = $roweduc['school'];?>
                        </td>
                        <td>
						<?=$fos = $roweduc['fieldofstudy'];?>
                        </td>
                        <td>
						<?=$major = $roweduc['major'];?>
						</td>
                        <td>
                        <?=$graddate = $roweduc['graddate'];?>
						</td>
                        <td>
                        <?=$loc = $roweduc['unilocation'];?>	
						</td>
						
                        <?php					
						}
					?>
                    </table>
                    </div>
                </div>
               <div class="workexpcontainer">
               		<div class="workexpdetails">
                    	<center>
                        Working Experience
                    	</center>
                    </div>
                    <div class="workbody">
                    <table width="100%" border="9">
                    <tr>
                    <th>
                    Position Title
                    </th>
                    <th>
                    Company Name
                    </th>
                    <th>
                    Company Location
                    </th>
                    <th>
                    From
                    </th>
                    <th>
                    TO
                    </th>
                    <th>
                    Experience Level
                    </th>
                    <th>
                    Description
                    </th>
                    </tr>
					
					<?php 
					while($rowexp = mysql_fetch_array($getexp))
					{
					?>	
                    <tr>
                    <td>
                    <?=$rowexp['positiontitle']?>
                    </td>
                    <td>
                    <?=$rowexp['companyname']?>
                    </td>
                    <td>
                    <?=$rowexp['companyadd']?>
                    </td>
                    <td>
                    <?=$rowexp['Fromdate']?>
                    </td>
                    <td>
                    <?=$rowexp['Todate']?>
                    </td>
                    <td>
                    <?=$rowexp['explevel']?>
                    </td>
                    <td>
                    <?=$rowexp['expdescription']?>
                    </td>
                    </tr>
						
					<?php
						}
					?>
                    </table>
                    </div>
               </div>
               <div class="remarkscontainer">
               		<div class="remarksdetails">
                    	Remarks
                    </div>
                    <div class="remarksbody">
                    	<center>
                         <?php 
						 $rowhired = mysql_fetch_array($gethired);
						 if($rowhired['total'] == 1)
						 {
							 $getename = mysql_fetch_array(mysql_query("SELECT e.ename as company
							 											FROM hired_applicants ha
																		left join employer e on e.employer_id = ha.employer_id
																		left join applicant a on ha.applicant_id = a.applicant_id
																		where ha.applicant_id = '$appid'
																		"));
							 $cname = $getename['company'];
							 echo "<br><br><font color='red'> Hired by $cname </font>";
							 }
						 else
						 {
							 echo "<br><br><font color='green'> Available for Employment </font>";
							 
							 }
						 ?>
                        </center>
                    </div>
               </div>
               
            </div>        
        </div>
    </div>
</div>

<div class="footer">
        	
            <div style="margin-top:20px; float:left; width:100%;">
            <center>
            
            <p>Copyright @ Famous Labor Supply Service Alright Reserve 2015</p>
            </center>
            </div>
        </div> 

</body>
</html>